//
//  ImageCollectionCell.m
//  BXlive
//
//  Created by bxlive on 2017/5/8.
//  Copyright © 2017年 cat. All rights reserved.
//

#import "ImageCollectionCell.h"
#import <SLDeveloperTools/SLDeveloperTools.h>
#import <SDAutoLayout/SDAutoLayout.h>

@implementation ImageCollectionCell
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.imageView = [[UIImageView alloc] init];
        [self addSubview:self.imageView];
        self.imageView.contentMode = UIViewContentModeCenter;
        self.imageView.backgroundColor = sl_subBGColors;
        self.imageView.sd_layout.leftSpaceToView(self, 0).rightSpaceToView(self, 0).topSpaceToView(self, 0).bottomSpaceToView(self, 0);
        self.imageView.sd_cornerRadius = @(12);
        UIImage *image = [UIImage imageNamed:@"tpsc"];
        self.deleteBtn = [UIButton initWithFrame:CGRectZero image:image];
        [self addSubview:self.deleteBtn];
        self.deleteBtn.sd_layout.topSpaceToView(self,0).rightSpaceToView(self,0).widthIs(18).heightIs(18);
        [self.deleteBtn addTarget:self action:@selector(deleteSelectImage) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

- (void)deleteImage:(DeleteImage)deleteImage
{
    _deleteImage = deleteImage;
}

- (void)deleteSelectImage
{
    if (self.deleteImage) {
        self.deleteImage();
    }
}

@end
